#pragma once
//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include <VxUtilLib/VxDefs.h>
#include <VxUtilLib/VxMacros.h>

#define RC_SYS_PKT_FIND_FILE_MAX_SEARCH_LEN			(255 + 16)
#define RC_SYS_PKT_FIND_FILE_MAX_RESULT_LEN			16000

#pragma pack(push) 
#pragma pack(1)
class RcSysPktFindFileReq : public RcSysPktHdr
{
public:
	//=== vars ===//
	U8			m_u8MatchType;
	U8			m_u8FileType;
	U16			m_u16Res1;
	U32			m_u32Res2;

	char		m_as8SearchExpression[ RC_SYS_PKT_FIND_FILE_MAX_SEARCH_LEN ];
	
	//=== constructor ===//
	RcSysPktFindFileReq()
		: m_u8MatchType(0)
		, m_u8FileType(0)
		, m_u16Res1(0)
		, m_u32Res2(0)
	{
		m_u16PktType = RC_SYS_PKT_TYPE_FIND_FILE_REQ;
		m_as8SearchExpression[0] = 0;

		calcPktLen();
	}

	void calcPktLen( void )
	{
		m_u16PktLen = ROUND_TO_16BYTE_BOUNDRY( sizeof( RcSysPktFindFileReq ) - RC_SYS_PKT_FIND_FILE_MAX_SEARCH_LEN + strlen(m_as8SearchExpression) );
	}
};

class RcSysPktFindFileReply : public RcSysPktHdr
{
public:
	//=== vars ===//
	U8			m_u8MatchType;
	U8			m_u8FileType;
	U16			m_u16MatchCount;
	U16			m_u16DataLen;
	U16			m_u16Res1;
	U32			m_u32Res2;
	U32			m_u32Res3;

	U8			m_as8SearchResult[ RC_SYS_PKT_FIND_FILE_MAX_RESULT_LEN ];

	//=== constructor ===//
	RcSysPktFindFileReply()
		: m_u8MatchType(0)
		, m_u8FileType(0)
		, m_u16MatchCount(0)
		, m_u16DataLen(0)
		, m_u16Res1(0)
		, m_u32Res2(0)
		, m_u32Res3(0)
	{
		m_u16PktType = RC_SYS_PKT_TYPE_FIND_FILE_REPLY;
		m_as8SearchResult[0] = 0;

		calcPktLen();
	}

	void calcPktLen( void )
	{
		m_u16PktLen = ROUND_TO_16BYTE_BOUNDRY( sizeof( RcSysPktFindFileReply ) - RC_SYS_PKT_FIND_FILE_MAX_RESULT_LEN + m_u16DataLen );
	}
};

#pragma pack(pop)




